{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Getting Started with Matplotlib" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Why are we using Pandas? \n", "\n", "Pandas actually has a few functions that are similar to D3 functions. So, we can learn two things at the same time. " ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "ename": "ModuleNotFoundError", "evalue": "No module named 'matplotlib'", "output_type": "error", "traceback": [ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[0;31mModuleNotFoundError\u001b[0m Traceback (most recent call last)", "Cell \u001b[0;32mIn[1], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mmatplotlib\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mpyplot\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m \u001b[38;5;21;01mplt\u001b[39;00m\n\u001b[1;32m 2\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mpandas\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m \u001b[38;5;21;01mpd\u001b[39;00m\n", "\u001b[0;31mModuleNotFoundError\u001b[0m: No module named 'matplotlib'" ] } ], "source": [ "import matplotlib.pyplot as plt\n", "import pandas as pd" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Getting the data" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "url=\"https://gist.githubusercontent.com/dudaspm/e518430a731ac11f52de9217311c674d/raw/4c2f2bd6639582a420ef321493188deebc4a575e/StateCollege2000-2020.csv\"\n", "data = []\n", "data=pd.read_csv(url)\n", "data = data.fillna(0) # replace all NAs with 0s" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Viewing the data" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | DATE | \n", "DAY | \n", "MONTH | \n", "YEAR | \n", "PRCP | \n", "SNOW | \n", "TMAX | \n", "TMIN | \n", "WT_FOG | \n", "WT_THUNDER | \n", "WT_SLEET | \n", "WT_HAIL | \n", "WT_GLAZE | \n", "WT_HIGHWINDS | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | \n", "1/1/2000 | \n", "1 | \n", "1 | \n", "2000 | \n", "0.00 | \n", "0.0 | \n", "44.0 | \n", "23 | \n", "0.0 | \n", "0.0 | \n", "0.0 | \n", "0.0 | \n", "0.0 | \n", "0.0 | \n", "
1 | \n", "1/2/2000 | \n", "2 | \n", "1 | \n", "2000 | \n", "0.00 | \n", "0.0 | \n", "52.0 | \n", "23 | \n", "0.0 | \n", "0.0 | \n", "0.0 | \n", "0.0 | \n", "0.0 | \n", "0.0 | \n", "
2 | \n", "1/3/2000 | \n", "3 | \n", "1 | \n", "2000 | \n", "0.01 | \n", "0.0 | \n", "60.0 | \n", "35 | \n", "0.0 | \n", "0.0 | \n", "0.0 | \n", "0.0 | \n", "0.0 | \n", "0.0 | \n", "
3 | \n", "1/4/2000 | \n", "4 | \n", "1 | \n", "2000 | \n", "0.12 | \n", "0.0 | \n", "62.0 | \n", "54 | \n", "0.0 | \n", "0.0 | \n", "0.0 | \n", "0.0 | \n", "0.0 | \n", "0.0 | \n", "
4 | \n", "1/5/2000 | \n", "5 | \n", "1 | \n", "2000 | \n", "0.04 | \n", "0.0 | \n", "60.0 | \n", "30 | \n", "0.0 | \n", "0.0 | \n", "0.0 | \n", "0.0 | \n", "0.0 | \n", "0.0 | \n", "